<%layout("/common/_layout.html"){ %>
  <%#ajax userTable:{%>
  <div class="am-cf am-padding">
    <div class="am-fl am-cf"><strong class="am-text-primary am-text-lg">系统管理</strong> / <small>渠道层级展示</small></div>
  </div>
 <script type="text/javascript">
    var urlBase = "${base}";
 </script>
 <form class="am-form" id="list-form" action="${base}/website/showWebsites/${parent.id!'0'}" method="post">
  
  <div class="am-u-sm-12">
      <table class="am-table am-table-bordered am-table-radius table-main">
      <input type="hidden" id="keywords" name="keywords" value='${keywords!""}' />
        <tbody>
          <tr>
            <th class="am-text-middle">渠道名称</th>
            <td>
              <div class="am-u-sm-12 am-u-md-12">
                <input type="text" name="class_name" id="class_name" class="am-form-field am-input-sm" placeholder="在${parent.class_name!'第一级'}下搜索" value="${class_name!}">
               
              </div>
            </td>
            <td >
                <div align='center'>
                  <button id="search" type="button"  class="am-btn am-btn-default am-btn-sm am-text-secondary">搜索</button>
                </div>
              </td>
          </tr>
        </tbody>
      </table>
    </div>
 
  <div class="am-g" >
    <div class="am-u-sm-12 am-scrollable-horizontal">
      <!--  padding:1px 2px 3px 4px;上、右、下,和左   -->
      <table class="am-table am-table-striped am-table-hover table-main">
        <thead>
          <tr class="am-text-nowrap">
            <th class="table-id">序号</th>
            <th class="table-title">渠道编码</th>
            <th class="table-title">渠道名称</th>
            <th class="table-title">父级名称</th>
            <th class="table-title">是否可用</th>
            <th class="table-title">是否开放</th>
            <th class="table-title">层级</th>
            <th class="table-title">层级描述</th>
          </tr>
        </thead>
        <tbody>
          <%for(website in pager.list!){%>
	          <tr>
	          	<td class="table-id">${website.id}</td>
	            <td class="table-title">${website.WebsiteId}</td>
	            <td class="table-title"><a title="点击显示下级" href="${base}/website/showWebsites/${website.id}">${website.class_name}</a></td>
	            <td class="table-title">${website.parentName}</td>
	            <td class="table-title"><%if(website.enabled=='1'){%>可用<%}else{%>不可用<%}%></td>
	            <td class="table-title"><%if(website.class_type==1){%>开放<%}else{%>非开放<%}%></td>
	            <td class="table-title">${website.level}</td>
	            <td class="table-title"><%if(website.level==1){%>渠道大类<%}else if(website.level==2){%>渠道簇<%}else{%>渠道小类<%}%></td>
	          </tr>
          <%}%>
        </tbody>
    </table>

    <div class="am-cf">
      <!-- 分页 -->
      <%if (pager.list.~size > 0){%>
	      <div class="am-fr">
	        <% include("/admin/common_pager.tpl"){}%>
	      </div>
      <%}else{%>
	      <div class="am-kai">
	        <h3>没有找到任何记录!</h3>
	      </div>
      <%}%>
   </div>
   <%if(has(parent)){%>
	<button type="button" class="am-btn am-btn-warning am-btn-xs" onclick="window.location.href='${base}/website/showWebsites/${parent.parentId!0}'">返回上一级</button>   
   <%}%>
   </div>
   </div>
<%}%>
  

<script type="text/javascript">
    $(function(){
      var keywordsObj = {};
      $("#search").on("click",function(){
          keywordsObj.class_name = $("#class_name").val();
          var keywords = "";
          if(!$.isEmptyObject(keywordsObj)){
            keywords = JSON.stringify(keywordsObj);
          }
          console.log("dk keywords = "+ keywords);

          $("#pageNumber").val("1");
          $("#keywords").val(keywords);
          $("#list-form").submit();
      });
    });
  </script>
  
<%}%>



